{{> partials/menu}}
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
    <div class="col-sm-12">
        <h2>View Order</h2>
    </div>
    <div class="order-layout col-md-12">
        <div class="row">
            <div class="col-md-12 bottom-pad-20">
                <button id="orderStatusUpdate" class="btn btn-outline-success float-left">{{ @root.__ "Update status" }}</button>
                <a href="/admin/orders" class="btn btn-outline-info float-right">{{ @root.__ "Go Back" }}</a>
            </div>
        </div>
        <ul class="list-group">
            <li class="list-group-item list-group-input-pad">
                <strong> Order status: </strong><span class="text-{{getStatusColor result.orderStatus}} float-right">{{result.orderStatus}}</span>
                <div class="float-right col-md-2">
                    <select class="form-control" id="orderStatus">
                        <option>{{ @root.__ "Completed" }}</option>
                        <option>{{ @root.__ "Paid" }}</option>
                        <option>{{ @root.__ "Pending" }}</option>
                        <option>{{ @root.__ "Cancelled" }}</option>
                        <option>{{ @root.__ "Declined" }}</option>
                        <option>{{ @root.__ "Shipped" }}</option>
                    </select>
                </div>
            </li>
            <li class="list-group-item"><strong> {{ @root.__ "Order date" }}: </strong><span class="float-right">{{formatDate result.orderDate "DD/MM/YYYY hh:mmA"}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Order ID" }}: </strong><span class="float-right">{{result._id}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Payment Gateway ref" }}: </strong><span class="float-right">{{result.orderPaymentId}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Payment Gateway" }}: </strong><span class="float-right">{{result.orderPaymentGateway}}</span></li>
            {{#if result.orderExpectedBtc }}
            <li class="list-group-item"><strong> {{ @root.__ "Order Expected BTC" }}: </strong><span class="float-right">{{result.orderExpectedBtc}}</span></li>
            {{/if}}
            {{#if result.orderReceivedBtc }}
            <li class="list-group-item"><strong> {{ @root.__ "Order Received BTC" }}: </strong><span class="float-right">{{result.orderReceivedBtc}}</span></li>
            {{/if}}
            {{#if result.orderBlockonomicsTxid }}
            <li class="list-group-item"><strong> {{ @root.__ "Order Blockonomics Txid" }}: </strong><span class="float-right">{{result.orderBlockonomicsTxid}}</span></li>
            {{/if}}
            {{#if result.orderPaymentMessage}}
            <li class="list-group-item"><strong> {{ @root.__ "Payment Message" }}: </strong><span class="float-right">{{result.orderPaymentMessage}}</span></li>
            {{/if}}
            <li class="list-group-item"><strong> {{ @root.__ "Order net amount" }}: </strong><span class="float-right">{{currencySymbol config.currencySymbol}}{{formatAmount (math result.orderTotal '-' result.orderShipping)}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Order shipping amount" }}: </strong><span class="float-right">{{currencySymbol config.currencySymbol}}{{formatAmount result.orderShipping}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Order total amount" }}: </strong><span class="float-right">{{currencySymbol config.currencySymbol}}{{formatAmount result.orderTotal}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Email address" }}: </strong><span class="float-right">{{result.orderEmail}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Company" }}: </strong><span class="float-right">{{result.orderCompany}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "First name" }}: </strong><span class="float-right">{{result.orderFirstname}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Last name" }}: </strong><span class="float-right">{{result.orderLastname}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Address 1" }}: </strong><span class="float-right">{{result.orderAddr1}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Address 2" }}: </strong><span class="float-right">{{result.orderAddr2}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Country" }}: </strong><span class="float-right">{{result.orderCountry}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "State" }}: </strong><span class="float-right">{{result.orderState}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Postcode" }}: </strong><span class="float-right">{{result.orderPostcode}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Phone number" }}: </strong><span class="float-right">{{result.orderPhoneNumber}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Order type" }}: </strong><span class="float-right">{{result.orderType}}</span></li>
            <li class="list-group-item"><strong> {{ @root.__ "Order comment" }}: </strong><span class="float-right">{{result.orderComment}}</span></li>

            <li class="list-group-item">&nbsp;</li>
            <li class="list-group-item"><strong class="text-info">{{ @root.__ "Products ordered" }}</strong></li>
            {{#each result.orderProducts}}
                <li class="list-group-item">
                    {{this.quantity}} x {{this.title}}
                    {{#if this.variantId}}
                        &nbsp; > &nbsp;
                        <span class="text-warning"> {{ @root.__ "Options" }}: </span>
                        {{this.variantTitle}}
                    {{/if}}
                    <div class="float-right">{{currencySymbol @root.config.currencySymbol}}{{formatAmount this.totalItemPrice}}</div>
                    {{#if productComment}}
                    <h4><span class="text-danger">Comment:</span> {{this.productComment}}</h4>
                    {{/if}}
                </li>
            {{/each}}
        </ul>
        <input type="hidden" id="order_id" value="{{result._id}}">
    </div>
</main>